﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using Utils;
namespace UI.ModSalary
{
	public partial class JJNormalList : System.Web.UI.Page
	{
        JJBiz jjBiz=new JJBiz();
		protected void Page_Load(object sender, EventArgs e)
		{
            if (!IsPostBack)
            {
                btnAdd.Attributes.Add("onclick", "javascript:ShowLink('JJNormalAdd.aspx',800,550);");
                btnProducts.Attributes.Add("onclick", "javascript:ShowLink('JjProducts.aspx',800,550);");
              
            }
		}

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string serWord = txtSerWord.Text.Trim();
            string bTime = txtBtime.Text.Trim();
            string eTime = txtEtime.Text.Trim();
            if (StringUtility.GetDiffDays(bTime, eTime) > XmlUtility.GetNumFormConfig("daysOfSearch"))
            {
                JSUtility.Alert(this, "查询日期间隔不能大于" + XmlUtility.GetNumFormConfig("daysOfSearch") + "天！");
                return;
            }
            DataTable dt = jjBiz.GetLists(serWord, bTime, eTime, "", "");
            gvList.DataSource = dt;
            gvList.DataBind();

        }

        protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Footer)
            {

                //int cols = gvList.HeaderRow.Cells.Count - 1;
                e.Row.Cells[0].Text = "合计";
                for (int i = 5; i < 8; i++)
                { 
                    e.Row.Cells[i].Text = Utils.ToolUtility.ReturnTotal(gvList, i).ToString();
                }
            }
        }
	}
}